unit UFluxoVisualizacao;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, DBGrids, DB;

type
  TFFluxoVisualizacao = class(TForm)
    dsFluxo: TDataSource;
    dbgFluxo: TDBGrid;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure dbgFluxoTitleClick(Column: TColumn);
    procedure dbgFluxoDrawColumnCell(Sender: TObject; const Rect: TRect;
      DataCol: Integer; Column: TColumn; State: TGridDrawState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FFluxoVisualizacao: TFFluxoVisualizacao;

implementation

uses URelFluxoCaixa, UGeral;

{$R *.dfm}

procedure TFFluxoVisualizacao.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  FFluxoVisualizacao.Release;
  FFluxoVisualizacao := nil;
end;

procedure TFFluxoVisualizacao.dbgFluxoTitleClick(Column: TColumn);
var
  qtd : string;
begin

  dbgFluxo.DataSource.DataSet.Next;
  while not(dbgFluxo.DataSource.DataSet.Eof) or (dbgFluxo.DataSource.DataSet.Fields[0].AsString = 'SALDO_FINAl') do
  begin
    dbgFluxo.DataSource.DataSet.Next;
  end;
end;

procedure TFFluxoVisualizacao.dbgFluxoDrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn;
  State: TGridDrawState);
begin
    if dbgFluxo.DataSource.DataSet.FieldByName('TIPO').AsString = 'S' then
      dbgFluxo.Canvas.Brush.Color := clScrollBar
    else
      dbgFluxo.Canvas.Brush.Color := clWhite;

  dbgFluxo.Canvas.Font.Color := clBlack;
  dbgFluxo.DefaultDrawDataCell( Rect, Column.Field, State);

end;

end.
